//
//  Team9ExpertSectionHeaderView.m
//  Team9Project
//
//  Created by 朱嘉祺 on 15/10/19.
//  Copyright © 2015年 apple. All rights reserved.
//

#import "Team9ExpertSectionHeaderView.h"
#import "Team9JQHeader.h"

@interface Team9ExpertSectionHeaderView ()

@property(nonatomic, strong)UIButton *button;

@end

@implementation Team9ExpertSectionHeaderView

- (instancetype)init{
    self = [super init];
    if (self) {
        self.titleLabel = [[Team9BaseLabel alloc]init];
        [self addSubview:_titleLabel];
    
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.equalTo(self).offset(10);
        }];
        
    }
    return self;
}
- (void)setBlock:(void (^)())block
{
    if (_block != block) {
        _block = block;
        _button = nil;
    }
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:_button];
    [_button setTitle:@"更多" forState:UIControlStateNormal];
    [_button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-10);
        make.centerY.equalTo(self);
    }];
    [_button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)click:(id)sender{
    self.block();
}
@end
